"use client";
import Script from "next/script";
import Link from "next/link";
import React from "react";

export default function Header() {
  // 使用 useState 和 useEffect 来管理浏览器检测状态
  const [isChrome, setIsChrome] = React.useState(true);

  React.useEffect(() => {
    setIsChrome(
      window.navigator.userAgent.includes("Chrome") &&
      !window.navigator.userAgent.includes("Chromium")
    );
  }, []);

  return (
    <>
      <header className="text-white w-full p-5 sm:px-10 flex justify-between items-center fixed top-0 left-0 right-0 z-50">
        <Link href="/">
          <div className="text-2xl font-bold e">SNERDI</div>
          <div className="text-xl e text-red-500">
            {isChrome
              ? ""
              : "This browser is not supported! Please use Chrome."}
          </div>
        </Link>
        <div className="text-2xl e">
          <span>上海核工程研究设计院股份有限公司机器人平台</span>
        </div>
      </header>
    </>
  );
}
